{include file="public_head" /}

<!-- datatables -->
<link href="__STATIC__/js/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
<!-- chk_3 -->
<link href="__STATIC__/css/chk_3.css" rel="stylesheet" type="text/css"/>
<!-- Select2 -->
<link href="__STATIC__/css/select/select2.min.css" rel="stylesheet">
<body class="nav-md">

<div class="container body">


    <div class="main_container">

        {include file="public_sidebar,public_nav" /}

        <!-- page content -->
        <div class="right_col" role="main">
            <div class="">
                <div class="page-title">
                    <div class="title_left">
                        <h3>

                        </h3>
                    </div>
                </div>
                <div class="clearfix"></div>

                <div class="row">

                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <div class="x_panel">
                            <div class="x_title">
                                <h2>{eq name="$auding_status" value="2"}全部团队{else/}我的团队{/eq}-<span style="font-size:14px;color: #73879C">业务员级别</span></h2>
                                <div class="clearfix"></div>
                            </div>
                            <div class="x_content">
                                <form name="form" id="form" method="get" action="">
                                    <div class="title_left">

                                        <div class="input-group col-md-2 col-sm-3 col-xs-4" style="float: left;">



                                        <select name="salesman_id" class="select2_single" style="width: 100%;"

                                        tabindex="-1">

                                        <option value="0">- 请选择业务员 -</option>

                                            {volist name="sl" id="item"}

                                        <option value="{$item.id}" {eq name=':input("salesman_id")' value='$item.id' }selected{/eq}>{$item.nickname}</option>

                                            {/volist}
                                        </select>

                                        </div>


                                        <div class="input-group" style="float: left;margin: 0 20px; position: relative;z-index: 10000">
                                            <input type="text" class="form-control" name="interval_timer"
                                                   id="interval_timer"
                                                   style="width: 200px;"
                                                   placeholder="请选择时间区间..." value="{:input('interval_timer')}">
                                        </div>

                                        <button type="submit" class="btn btn-primary" style="margin-left: 10px;">搜 索

                                        <!--</button>-->
                                    </div>
                                    <form>


                                    <table style="border-bottom:1px solid #ddd;"
                                           class="table table-striped table-bordered table-hover">
                                        <thead>
                                        <tr class="success">
                                            <!--<th style="width: 2%; padding: 10px;">-->
                                                <!--<input type="checkbox" class="checkall"-->
                                                       <!--onclick="CheckAll(this.checked);"/>-->
                                            <!--</th>-->
                                            <!--<th>排序</th>-->
                                            <th width="30">ID</th>
                                            <th width="">业务员名称</th>
                                            <th width="">业务员电话</th>
                                            <th width="">创建时间</th>
                                            <th width="">用户数量</th>

                                            <th>操作</th>

                                        </tr>
                                        </thead>
                                        <tbody>
                                        <!--{empty name="data"}-->
                                            <!--<tr><td colspan="5"><div style='font-size:24px;margin:30px 0;'>没有找到记录</div></td></tr>-->
                                        <!--{/empty}-->

                                        {volist name="s_list" id="item"}
                                        <tr class="cat_0">
                                            <td>{$item.id}</td>
                                            <td style="text-align: left;">{$item.nickname}</td>
                                            <td>{$item.telephone}</td>
                                            <td>{$item.create_time}</td>
                                            <td>{$item.member_count}</td>
                                            <td class="operate" >
                                                <div>
                                                    {eq name=":session('role_id')" value="4"}{else/} <a href="{:url('update', ['id' => $item['id']])}"
                                                       class="label label-primary">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;修改上级
                                                    </a>
                                                    {/eq}
                                                    <a href="{:url('member', ['id' => $item['id']])}"
                                                       class="label label-primary">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;名下会员
                                                    </a>
                                                    {eq name=":session('role_id')" value="4"}{else/}
                                                    <a href="{:url('update_level', ['manage_id' => $item['id']])}"
                                                       class="label label-primary">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;转移下级
                                                    </a>
                                                    {/eq}
                                                    {eq name="$auding_status" value="2"}
                                                    <!--<a href="{:url('destroy', ['id' => $item['id']])}"-->
                                                    <!--class="label label-danger"-->
                                                    <!--onClick="return confirm('确定删除吗?')"-->
                                                    <!--&gt;-->
                                                    <!--<span class="fa fa-times"></span>&nbsp;&nbsp;删 除-->
                                                    <!--</a>-->
                                                    {/eq}

                                                </div>
                                            </td>
                                        </tr>
                                        {/volist}

                                        {volist name="data" id="item"}
                                        <tr class="cat_{$item.level}">
                                            <td>{$item.id}</td>
                                            <td style="text-align: left;">{eq name="$item.level" value="1"}<span class="minusSign click_cat_{$item.level}" id="on">&nbsp;&nbsp;&nbsp;&nbsp;</span>{/eq}{neq name="$item.parent_id" value="0"}{:str_repeat('&nbsp&nbsp&nbsp',$item.level)}{/neq}|{:str_repeat('--',1)}{$item.nickname}</td>
                                            <td>{$item.telephone}</td>
                                            <td>{$item.create_time}</td>
                                            <td>{$item.member_count}</td>
                                            <td class="operate" >
                                                <div>
                                                    {eq name=":session('role_id')" value="4"}{else/}
                                                    <a href="{:url('update', ['id' => $item['id']])}"
                                                       class="label label-primary">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;修改上级
                                                    </a>
                                                    {/eq}
                                                    <a href="{:url('member', ['id' => $item['id']])}"
                                                       class="label label-primary">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;名下会员
                                                    </a>
                                                    {eq name=":session('role_id')" value="4"}{else/}
                                                    <a href="{:url('update_level', ['manage_id' => $item['id']])}"
                                                       class="label label-primary">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;转移下级
                                                    </a>
                                                    {/eq}
                                                    {eq name="$auding_status" value="2"}
                                                    <!--<a href="{:url('destroy', ['id' => $item['id']])}"-->
                                                       <!--class="label label-danger"-->
                                                       <!--onClick="return confirm('确定删除吗?')"-->
                                                    <!--&gt;-->
                                                        <!--<span class="fa fa-times"></span>&nbsp;&nbsp;删 除-->
                                                    <!--</a>-->
                                                    {/eq}

                                                </div>
                                            </td>
                                        </tr>
                                        {/volist}

                                        </tbody>
                                    </table>
                                        <button type="button" class="btn btn-info" style="margin-top: 20px;" {eq name=":session('role_id')" value="4"}onclick="layer.msg('业务员没有导出权限')"{else/}onclick="dc({:input('coupon_id')}){/eq}">业务员导出</button>
                                </form>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>
        <!-- /page content -->
    </div>

</div>

{include file="public_foot" /}
<!-- public -->
<script src="__STATIC__/js/public.js"></script>
<!-- layer -->
<script src="__STATIC__/js/layer.js"></script>
<!--select-->
<script src="__STATIC__/js/select/select2.full.min.js"></script>
<style>
    .minusSign{ background-position: 0 -34px}
</style>
<script>

    function dc() {
        var salesman_id = {:input('salesman_id',0)};
        var both = "{:input('interval_timer')}";
        window.location.href= "{:url('my_team')}?export=e&salesman_id="+salesman_id+'&interval_timer='+both;
    }
    $(document).ready(function () {
        // select2
        $(".select2_single").select2({
            placeholder: "请选择分类",
            allowClear: true
        });
    });
    $('#interval_timer').daterangepicker(null,
        function(start, end, label) {
//                console.log(start.toISOString(), end.toISOString(), label);
        });
    $('.click_cat_1').click(function(){
        var of = $(this).attr('id');
        if(of == 'on'){ //当时按钮列表是开启 就关闭
            $(this).attr('id','off');
            $(this).parent().parent('tr').nextUntil('.cat_1').hide();
            $(this).css("background-position","0 9px");
            //$(this).find('td').eq(1).find('span').css("background-position","0 9px");
        }else{
            $(this).attr('id','on');
            $(this).parent().parent('tr').nextUntil('.cat_1').show();
            $(this).css("background-position","0 -34px");
        }
    });
</script>